package org.example;

import java.util.Collections;
import java.util.List;
import org.keycloak.Config.Scope;
import org.keycloak.authentication.Authenticator;
import org.keycloak.authentication.AuthenticatorFactory;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.AuthenticationExecutionModel.Requirement;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.provider.ProviderConfigProperty;

public class AuthenticatorSpiDemoProviderFactory implements AuthenticatorFactory {

    public static final Requirement[] REQUIREMENT_CHOICES = {
            Requirement.REQUIRED,Requirement.ALTERNATIVE,Requirement.DISABLED
    };

    @Override
    public String getDisplayType() {
        return "auth-demo";
    }

    @Override
    public String getReferenceCategory() {
        return "hgjkgkj";
    }

    @Override
    public boolean isConfigurable() {
        return false;
    }

    @Override
    public Requirement[] getRequirementChoices() {
        return REQUIREMENT_CHOICES;
    }

    @Override
    public boolean isUserSetupAllowed() {
        return false;
    }

    @Override
    public String getHelpText() {
        return "help text";
    }

    @Override
    public List<ProviderConfigProperty> getConfigProperties() {
        return Collections.emptyList();
    }

    @Override
    public Authenticator create(KeycloakSession session) {
        System.err.println("create auth demo authenticate");
        return new AuthenticatorSpiDemo();
    }

    @Override
    public void init(Scope config) {

    }

    @Override
    public void postInit(KeycloakSessionFactory factory) {

    }

    @Override
    public void close() {

    }

    @Override
    public String getId() {
        return "auth-demo-1";
    }
}
